Skip to contentSkip to conversation

conditional inheriting classes does not work with bbappends

DISCUSSION Christian Eggers 5 participants 8 messages Apr 7, 2022 – Apr 14, 2022

lore
Share & tools
lore
#0 lore raw

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

_______________________________________________________
Christian
Eggers
Software Engineer
​
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17,
83071
Stephanskirchen
www.arri.com

+49 8036 3009-3118
[email protected]

​
Get all the latest information from www.arri.com, Facebook, Twitter, Instagram, LinkedIn and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

​

#1 lore raw

There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

--
Christopher Larson
[email protected], [email protected], [email protected] Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software

Quoted 61 lines · On Apr 7, 2022, 7:17 AM -0700, Christian Eggers <[email protected]>, wrote:

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

_______________________________________________________
Christian
Eggers
Software Engineer

ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17 ,
83071
Stephanskirchen
www.arri.com

+49 8036 3009-3118
[email protected]

Get all the latest information from www.arri.com, Facebook, Twitter, Instagram, LinkedIn and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13594): https://lists.openembedded.org/g/bitbake-devel/message/13594
Mute This Topic: https://lists.openembedded.org/mt/90313668/3617123
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 1 line · Christopher Larson

There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

ok, this is what I would expect. So how to handle this:

- do not conditionally inherit in PACKAGECONFIG (may be impossible)?
- do not set PACKAGECONFIG in bbappend files (use distro/machine/layer/local config for this)?

regards
Christian

Quoted 5 lines

--
Christopher Larson
[email protected], [email protected], [email protected] Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software

_______________________________________________________
Christian
Eggers
Software Engineer
​
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17,
83071
Stephanskirchen
www.arri.com

+49 8036 3009-3118
[email protected]

​
Get all the latest information from www.arri.com, Facebook, Twitter, Instagram, LinkedIn and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

​

Quoted 24 lines · On Apr 7, 2022, 7:17 AM -0700, Christian Eggers <[email protected]>, wrote:
Quoted 23 lines

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

#3 lore raw

I don’t think there is a generic solution to this problem. What we do in the particular case is to enable the PACKAGECONFIG in a bbappend and then also add an extra inherit useradd to the bbappend file. Not perfect, but it works.

//Peter

From: [email protected] <[email protected]> On Behalf Of Christian Eggers
Sent: den 8 april 2022 18:54
To: [email protected]; Christopher Larson <[email protected]>
Subject: Re: [bitbake-devel] conditional inheriting classes does not work with bbappends

Quoted 1 line · Christopher Larson

There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

ok, this is what I would expect. So how to handle this:

- do not conditionally inherit in PACKAGECONFIG (may be impossible)?
- do not set PACKAGECONFIG in bbappend files (use distro/machine/layer/local config for this)?

regards
Christian

Quoted 5 lines

--
Christopher Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]> Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software

_______________________________________________________​

Christian

Eggers

Software Engineer

​

ARRI

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG

Arriweg 17

,

83071

Stephanskirchen

www.arri.com

<http://www.arri.com/>

[cid:[email protected]]

+49 8036 3009-3118<tel:+49%208036%203009-3118>

[cid:[email protected]]

[email protected]<mailto:[email protected]>

​

[One modular system, two new stabilizers: ARTEMIS 2 & TRINITY 2]<https://www.arri.com/trinity2_artemis2>

Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://www.instagram.com/arri/>, LinkedIn<https://www.linkedin.com/company/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

​

Quoted 24 lines · On Apr 7, 2022, 7:17 AM -0700, Christian Eggers…
Quoted 23 lines

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'$%7bPN%7d',%20'',%20d)%7d>"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'--system%20-d%20/%20-M%20--shell%20/bin/nologin%20chronyd;',%20'',%20d)%7d>"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

#4 lore raw
Quoted 2 lines · Peter Kjellerstedt

I don’t think there is a generic solution to this problem. What we do in the particular case is to enable the PACKAGECONFIG in a bbappend and then also add an extra inherit useradd to the bbappend file. Not perfect, but it works.

I have also chosen this workaround. The problem is, that it does not work the other way around:

If the default value for PACKAGECONFIG causes conditionally inheriting specific classes, these classes will also be inherited if PACKAGECONFIG is overwritten later in a bbappend.

Quoted 3 lines

//Peter

_______________________________________________________
Christian
Eggers
Software Engineer
​
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17,
83071
Stephanskirchen
www.arri.com

+49 8036 3009-3118
[email protected]

​
Get all the latest information from www.arri.com, Facebook, Twitter, Instagram, LinkedIn and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

​
From: [email protected] <[email protected]> On Behalf Of Christian Eggers

Quoted 56 lines

Sent: den 8 april 2022 18:54
To: [email protected]; Christopher Larson <[email protected]>
Subject: Re: [bitbake-devel] conditional inheriting classes does not work with bbappends

Quoted 1 line · Christopher Larson

There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

ok, this is what I would expect. So how to handle this:

- do not conditionally inherit in PACKAGECONFIG (may be impossible)?
- do not set PACKAGECONFIG in bbappend files (use distro/machine/layer/local config for this)?

regards
Christian

Quoted 5 lines

--
Christopher Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]> Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software

_______________________________________________________​

​

Quoted 24 lines · On Apr 7, 2022, 7:17 AM -0700, Christian Eggers…
Quoted 23 lines

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'$%7bPN%7d',%20'',%20d)%7d>"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'--system%20-d%20/%20-M%20--shell%20/bin/nologin%20chronyd;',%20'',%20d)%7d>"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

#5 lore raw
In reply to Christopher Larson

Hi

Christopher Larson <[email protected]> escreveu no dia quinta, 7/04/2022 à(s) 22:59:

Quoted 3 lines

There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

Does the require have the same behaviour as the inherit? i.e: evaluated *at the moment of inherit*
if not something like that can do the job:

cat <<'EOF' > my.bbappend
PACKAGECONFIG ?= "my-knob"
require ${@bb.utils.contains('PACKAGECONFIG', 'my-knob', 'my-conditional-inheriting.inc', '', d)}
EOF

cat <<'EOF' >my-conditional-inheriting.inc
inherit my.bbclass
EOF

Jose

Quoted 92 lines

--
Christopher Larson
[email protected], [email protected], [email protected] Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software
On Apr 7, 2022, 7:17 AM -0700, Christian Eggers <[email protected]>, wrote:

Example: meta-openembedded/meta-networking/recipes-support/chrony/ chrony_4.2.bb

--------------------------------8<-------------------------------- # Add chronyd user if privdrop packageconfig is selected inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit"
statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I
must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to
PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

_______________________________________________________
Christian
Eggers
Software Engineer
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17 ,
83071
Stephanskirchen

*www.arri.com * <http://www.arri.com/>
*+49 8036 3009-3118* <+49%208036%203009-3118>
*[email protected]* <[email protected]>

[image: One modular system, two new stabilizers: ARTEMIS 2 & TRINITY 2]
<https://www.arri.com/trinity2_artemis2>
Get all the latest information from *www.arri.com* <https://www.arri.com/>
, *Facebook* <https://www.facebook.com/TeamARRI>, *Twitter*
<https://twitter.com/ARRIChannel>, *Instagram*
<https://www.instagram.com/arri/>, *LinkedIn*
<https://www.linkedin.com/company/arri> and *YouTube*
<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG

Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH

Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRB 54477

Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13595):
https://lists.openembedded.org/g/bitbake-devel/message/13595
Mute This Topic: https://lists.openembedded.org/mt/90313668/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma
#6 lore raw

Yes, require is evaluated immediately, just like inherit, so unfortunately the suggested example below doesn’t solve the problem either.

//Peter

From: [email protected] <[email protected]> On Behalf Of Jose Quaresma
Sent: den 13 april 2022 12:25
To: Christopher Larson <[email protected]>
Cc: [email protected]; Christian Eggers <[email protected]>
Subject: Re: [bitbake-devel] conditional inheriting classes does not work with bbappends

Hi

Christopher Larson <[email protected]<mailto:[email protected]>> escreveu no dia quinta, 7/04/2022 à(s) 22:59:
There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

Does the require have the same behaviour as the inherit? i.e: evaluated *at the moment of inherit* if not something like that can do the job:

cat <<'EOF' > my.bbappend
PACKAGECONFIG ?= "my-knob"
require ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'my-knob', 'my-conditional-inheriting.inc', '', d)} EOF

cat <<'EOF' >my-conditional-inheriting.inc
inherit my.bbclass
EOF

Jose

--
Christopher Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]> Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software
On Apr 7, 2022, 7:17 AM -0700, Christian Eggers <[email protected]<mailto:[email protected]>>, wrote:

Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb<http://chrony_4.2.bb>

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'$%7bPN%7d',%20'',%20d)%7d>"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'--system%20-d%20/%20-M%20--shell%20/bin/nologin%20chronyd;',%20'',%20d)%7d>"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

_______________________________________________________

Christian

Eggers

Software Engineer

ARRI

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG

Arriweg 17

,

83071

Stephanskirchen

www.arri.com

<http://www.arri.com/>

[cid:[email protected]]

+49 8036 3009-3118<tel:+49%208036%203009-3118>

[cid:[email protected]]

[email protected]<mailto:[email protected]>

[One modular system, two new stabilizers: ARTEMIS 2 & TRINITY 2]<https://www.arri.com/trinity2_artemis2>

Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://www.instagram.com/arri/>, LinkedIn<https://www.linkedin.com/company/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

--
Best regards,

José Quaresma

#7 lore raw

Hi,

For what is worth I always tweak PACKAGECONFIG values with recipe specific overrides instead of using bbappends. I define those overrides in a distro config or local.conf.

For instance

PACKAGECONFIG:pn-p11-kit ?= "trust-paths"

That should solve your problem.

I only use bbappends when some of the logic in the recipe needs to be tweaked, not when the configuration which is already supported by the base recipe needs to be adjusted.

Best,
--
Diego Santa Cruz, PhD
Technology Architect
spinetix.com

From: [email protected] <[email protected]> On Behalf Of Peter Kjellerstedt via lists.openembedded.org
Sent: 13 April 2022 12:36
To: Jose Quaresma <[email protected]>; Christopher Larson <[email protected]>
Cc: [email protected]; Christian Eggers <[email protected]>
Subject: Re: [bitbake-devel] conditional inheriting classes does not work with bbappends

Yes, require is evaluated immediately, just like inherit, so unfortunately the suggested example below doesn’t solve the problem either.

//Peter

From: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> On Behalf Of Jose Quaresma
Sent: den 13 april 2022 12:25
To: Christopher Larson <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>; Christian Eggers <[email protected]<mailto:[email protected]>>
Subject: Re: [bitbake-devel] conditional inheriting classes does not work with bbappends

Hi

Christopher Larson <[email protected]<mailto:[email protected]>> escreveu no dia quinta, 7/04/2022 à(s) 22:59:
There’s no way to avoid that, inherit lines are evaluated *at the moment of inherit* on that line, they aren’t postponed.

Does the require have the same behaviour as the inherit? i.e: evaluated *at the moment of inherit* if not something like that can do the job:

cat <<'EOF' > my.bbappend
PACKAGECONFIG ?= "my-knob"
require ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'my-knob', 'my-conditional-inheriting.inc', '', d)} EOF

cat <<'EOF' >my-conditional-inheriting.inc
inherit my.bbclass
EOF

Jose

--
Christopher Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>
Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software
On Apr 7, 2022, 7:17 AM -0700, Christian Eggers <[email protected]<mailto:[email protected]>>, wrote:
Example: meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.2.bb<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fchrony_4.2.bb%2F&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4fvCrQ%2FUpjM0cAlu46wXrUtVPDmyZzC6HxS19L3m%2Bls%3D&reserved=0>

--------------------------------8<--------------------------------
# Add chronyd user if privdrop packageconfig is selected
inherit ${@bb.utils.contains('PACKAGECONFIG<mailto:$%[email protected]('PACKAGECONFIG>', 'privdrop', 'useradd', '', d)}
USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'$%7bPN%7d',%20'',%20d)%7d>"
USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}<mailto:$%[email protected]('PACKAGECONFIG',%20'privdrop',%20'--system%20-d%20/%20-M%20--shell%20/bin/nologin%20chronyd;',%20'',%20d)%7d>"

...

PACKAGECONFIG ??= ... -------------------------------->8--------------------------------

Problem #1: useradd is not inherited because PACKAGECONFIG is set below the conditional "inherit" statement. Even when I add "privdrop" to PACKAGECONFIG here, useradd.bbclass is not inherited. I must move the PACKAGECONFIG line above the inherit statement to make this work.

Problem #2: Due to problem #1, useradd.bbclass is also not inherited when I add "privdrop" to PACKAGECONFIG in bbappend file (in a custom layer).

regards
Christian

_______________________________________________________
Christian

Eggers
Software Engineer
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Arriweg 17
,
83071

Stephanskirchen
www.arri.com

<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.arri.com%2F&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=tiJPvwRKsqyDuVJzhXKBT2ckZ78vM%2Fotp7q23xpqEbc%3D&reserved=0>
[cid:[email protected]]
+49 8036 3009-3118<tel:+49%208036%203009-3118>
[cid:[email protected]]
[email protected]<mailto:[email protected]>
[One modular system, two new stabilizers: ARTEMIS 2 & TRINITY 2]<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.arri.com%2Ftrinity2_artemis2&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1zOItD0N3d%2F8Y121EK5wZAEhnF5tpXcq4Ulz2CtNOxI%3D&reserved=0>
Get all the latest information from www.arri.com<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.arri.com%2F&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Y6X%2FJnaw7uSAtJHrGhRE2TpqxgjpEf9q4Tz9Ns9vDVU%3D&reserved=0>, Facebook<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FTeamARRI&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5UDNqJ9GbTT3iobu9u7jSXDNdReea2Dr1kS2ax5mx3s%3D&reserved=0>, Twitter<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FARRIChannel&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2Fj21U95e8A0XO05vD0UvJ%2FROmA2coFG81JTJ5kBYUkM%3D&reserved=0>, Instagram<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Farri%2F&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pvcUBxCa0rA4lrEkA4VV7CFDWH9TbLYqzYt90tAz2P4%3D&reserved=0>, LinkedIn<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Farri&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pjF3UBfGtV47BSLy8U%2B%2FqP19njbxzdWm3GyBnDAyAWo%3D&reserved=0> and YouTube<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FARRIChannel&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7C11c119e4d43f4016dbe408da1d395982%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637854429401057247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=u5oCqbTtXJz%2BtuFqzmj7lgBRRmlVyHcyW%2F91Pqs25XQ%3D&reserved=0>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRA 57918 Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München ‑ Registergericht: Amtsgericht München ‑ Handelsregisternummer: HRB 54477 Geschäftsführer: Dr. Matthias Erb (Chairman); Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger

--
Best regards,

José Quaresma